Fix multi-thread lock