fixed set_key_permissions to be cleaner and more expressive
bumped version