fix a bug in stack pop