fix infinite loop on commands

The array was not being shifted for all cases. This lead to the command
succeeding, but being retried anyway.
Merge pull request #4 from therealnb/master

fix infinite loop on commands