bug fixes for improve_ast.py (found by running on Python standard library)