! Make sure variables are defined before using them (fixes #2301)

Signed-off-by: Michael Eshom <oldiesmann@oldiesmann.us>