fix undefined function issues