fix for undefined local variable
better message for missing variable