fix a conversion warning
do not try to dereference an end iterator