Fixed bug in the Database class