fixed a, variable that could be undefined, bug