minimize.py added small bug fixes