Bug in App middleware