Fix: Take the iterator's end position into account

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>