bug fix for returning junctions