ops.py: make reinstall more robust