changed to batch mode and doing addiontal checks to ensure that is not crashing anymore