fixes in querying for usage, and sums