corrected incorrect pop/push order

fixed "minimum stack depth reached" error
Merge pull request #2 from Djent-/patch-2

corrected incorrect pop/push order