change Dir.exist? to File.exist? for 1.8.7