Bugfix: check array before shifting
Merge pull request #45 from g4b0/check-array-before-shifting

Bugfix: check array before shifting