debug print in middleware