fixing bugs in intersect