improved feedback for typecheck errors