fix for undefined local variables
better message for missing variable