added an option for no shock
improve crash prevention check