Fixes to the database class