thread lock fix & performance improve