fix bugs for extend capacity in Stack