Fixing middleware