fix bugs in new_env_clean; add type_infer to clean typeof expression in prim