Fixed undefined errors