working realloc