added system exit if exception is thrown