error handling for external programs