Fixed bugs in primitive intersection.