strange assert failure when stack is empty