assume stack is not initialized with NULL