inlined resize method