found and fixed bug - undefined variable