fix issue with pre/postAuthentication middleware arrays