fix for bug I introduced with my last fix.

I left 'end' in an undefined state before.