seems to have fixed bug, but need to remove prints
exception caused by edges in bboxes now fixed