changing is_dir checks to file_exists + include