better lock handling