master #12 fix reallocation algorithm