added uncaught exception logging and warning on missing middleware