fixed file exists function