Added mutex for db sync