Fix sorting query builder when created and called without being used