fix visit/index and sort dates