trying to fix recurions in AST flattener