fix Python lock