replace 2 error checks with one that reports to gui or stderr as appropriate