Change is_dir to file_exists.