Clean up some bugs in DB Handler.