implement free of AST nodes and fix a couple other memory issues