Fixed bug in typechecker