Fix bug where var might not have been set.