environment middleware runs last