Fixing database query fetch.