Some fixes on key generator and base64