fix bug in syntax error checking