fixed updating the database