fixed jshint undeclared variable error