modified the exception handling of the pig-script creation