uncommented middleware and fixed traceback problem