fixed bug in ideal_capacity