Fixed bug in Database class