code sample correction for middleware