Fix bug in terminateScriptOnError function
Add terminateScriptOnError in install script