some more cleanup, flush rewrite rules on deactivation. Closes #14