Fixed nil error reference
Merge pull request #1569 from khaullen/error_reference_fix

Fixed nil error reference