correct errors in typechecker