fixed bugs to allow completion of program when no junctions present