cleaned up and made tmp_dir
fixed a typo