rewrite hazard detection