Fixed the problem that the stack was popped when it was empty.
Merge branch 'hotfix/empty_stack'