Fixed bugs in syntaxtree generation