moved set lock loops inside setLock function