Fix first and last visit that was displayed in random order. Thanks to MangOuste for the report.