Got rid of undefined in error message.

The fix in the 2445 branch wasn't enough yet, with these extra changes it shows the error message it should.