Fixed incorrect maximum weight calculation.