Fix apply_affine_transform()