Fix messages list sorting with THREAD=REFS