Fixes to database class
Debugging database class