Better error handling

Also, fixes an error when attempting to call using
RedirectStandardOutput on some OS version.