Fixed #17. Added an uncaught exceptions handler.