Fix several bugs in /unlock