Added uncaughtException handler so that the standalone version no longer
crashes when exceptions occur.