Fixed undefined function error