repair table date sorting