fixed fileExists method