Fix error in lock range handling