bug fix in Typechecker and minor change to CodeGen