Fixed a rewrite bug