Fixed console error of undefined function