Fix duplicate entries in cache database