fix enter middleware execution order