WIP fixing DB query