fixes missing req/res in finalhandler, adds count to query results (via http headers)