added runtime check for thread crashes in main method