fixed the database part