try to improve realloc