Fix for queryParams.order being a function

When the queryParams.order is a function the fix produces incorrect query parameters.