corrected system() error mgmt