Fix a few bugs in replicated locks