Fixed incorrect logic in unlock safe code.
Fixed generic error in expression on safe code fix.