add exception count in main loop