rewrite optimizer to be more broken than before