Added r/w mutex to keyManager