make Rewrite to be usable with group references