fix performance regression in class