diff --git a/lib/poolparty/poolparty/key.rb b/lib/poolparty/poolparty/key.rb
index <HASH>..<HASH> 100644
--- a/lib/poolparty/poolparty/key.rb
+++ b/lib/poolparty/poolparty/key.rb
@@ -42,7 +42,7 @@ module PoolParty
     # then it returns nil and assumes we it doesn't exist
     def search_in_known_locations
       self.class.keypair_paths.each do |path|
-        full_path = ::File.join( ::File.expand_path(path), basename)
+        full_path = ::File.join( ::File.expand_path(path), ::File.basename(filepath))
         return full_path if ::File.exists?(full_path)
       end
       # raise Exception.new("We cannot continue without a keypair. Please define a keypair in your clouds.rb")
Updated key to pull the basename