Fix a bug where an undefined variable was used.