Changed Dir.exists? calls to File.directory? calls to work with 1.8.7