fix a bug in weight