Adding some diagnostics to help debug db