fix bad rewrite