fixed a bug in the database model