fixed use of undefined var