fix the private key file openning and getting the private key