fixed error not defined bug