Fixed issue #23 raise of StopIterator due to bad error checking code.