Fixing Enumerator.peek throws NullPointerException after the last item.

Fixing #1299