Changes to the code that handles errors.  

There was a free/unbound variable.  Looks like a copy paste bug.

Note I am not sure how this ever really worked.