bugfixes in database class