fixing date sorting issues