Avoid NoSuchElementException checking availability of next element
Merge pull request #17 from logoff/develop

Hotfix for NoSuchElementException