Fix broken logic about visit dates