Merge pull request #730 from fabro-sh/fix/max-visits-off-by-one