Fixed db cache race conditions.