Handle missing keys more gracefully in Db module.

Change-Id: Id38aae19d81b842d3f931011b5baa10299430a39