Avoid NoSuchElementException checking availability of next element
Merge pull request #18 from logoff/hotfix/messageQueue

Hotfix to message queue