add rewrite actions, prevent rewrite on deactivate