fixing date query