Fix code that got broken between rewrites