Added mutex locks to database editing functions