general modifications to typecheck