Update middleware