Balance stack and properly check class in prim 66