you can't dereference iterator that points to end()