Some rewrite and 1.7.2 support(early, so needs fixes)