Fixed a bug where maxWeight was not callculated