some changes to stack.c