fix a bug in the weaving process