various fixes and aded random key pair generator