added mainloop exception printing