Added extra check to fix bug in intersection.