minor edit in middleware