Fixing up 2nd mst algorigthm.