safe_stack: add pop() and top()