proper lock handling