Added mutex locks.