Mutex lock check added as suggested by projectkk2glider