fix ReferenceError issue