Some small changes on rewrite.py.