Minor fix to middleware!