add db cache test and fix bugs that were revealed