Fixed an issue if rewrite enabled