Fixed lock_thread_id = -1 issue