fix undefined function bug