fixed typo in weight computation