Issue #467 fix error check