Fix weight calculation