Fix handling of stashed changes that are not last in the stack

The code handling the case where the stashed changes produced by git-hub
were not last in the stash was completely broken after a refactoring
done in 84fcb10bce6b3b617fce6922c640b2b699aadda5.

This should finally fix #91.