fix yet another optimizer bug
test.py: automatically check if optimizations broke things