fix a bug in no_rewrite()