Fix some bugs in syntactic analysis