Fixed pre-mature exit of script.