Fixed reverting locks bug + refactored locks backup without reversing locks order