Fix a couple of errors where a variable was used when undefined