I don't think you want to add key and private_key. That will cause them to be added to the path variable automatically ("path << attrs.collect ....).  In the case of key, it will get added twice if it's there, and I don't think you ever want private_key added