fixed bugs with databaseModel