Fix some obvious bugs. Prepare more edgeweight.