Replace Dir.exists? with File.exists? (fix for Ruby 1.8)