Issue #23246:fix weight calculation