Fix error detection.  (a better fix is coming)
Merge pull request #1551 from brendandburns/fix

Fix error detection.  (a better fix is coming)