Add check for iterator == end