typecheck cleanup