Fixing the harden_security script, and adding some error-checking