intersect: fixed error and added test for that