Fixing midleware endpoint