improving lock handling.