Roll back optimize.py to previous version