fixed all interactions with the database