fixed bug in database class