fix a rewrite problem