changing is_dir checks tp file_exists