Fix database fetching