add edge weights
various fixes