clean-up unneeded stuff after rewrite