fix bug in program AST

naive implementation of fold
size function