fixed bugs in COMMON sema and codegen