fix "validateLine", add some comments