fixed the database issues