potential bug when reallocating