Remove reference to non-existant variable when encountering error state