Fixed problem when validating scripts with newlines and single quotes