fix bug regarding sync with cache and indeded DB