fixed malloc->realloc