Fixes to database class