Fixed bug related to popping from empty stack