better error reporting for external commands