Fixed a segfault related to incrementing an iterator past the end of a list