bug fixes, affine equivalences