Fix code that dereferenced an end iterator.