Fixes to db class