Fixed AST traversal bug introduced by updated stack operation