updating rewriting for flex backend