Fixed undefined bug