Fix undifined err bug