Fixed NoSuchElementException when undoing with more elements, than are stored.
Fixes #234.