Fix a bug of an undefined variable