Fix weight class division by zero