fixed bug: using wrong max_capacity