some small changes to date sorting