fixed bug when sorting

bug introduced at some stage where the sorted columns no longer expand
and collapse - this has been fixed