Added lock upgrade code