Fixing wrong realloc