fixed file_exists function