Replace as many patch as possible by environment set