fix the undefine function