Fixing duplicate middleware