fix a bug in stop_rewrite_phase