fixed typeError issue