bugfix for undefined var

bugfix for undefined var