fix database calls