fix junction detection