some bug fixing in keystore and refactoring in parameters