changed lock/unlock code to the new comming function