fixed a bug on MaxCapacity.