The problem is elsewhere so show us the full code (or at least some more).
In reply to Re: sort != sort by salva in thread sort != sort by halfcountplus