Guard against undefined variables

Under no circumstances do you want an undefined
value entering your system here. This just leads to
many sad pandas.
Merge pull request #2372 from stefanpenner/preventUndefinedsFromEntering

Guard against undefined variables