edit on middleware