fix silly realloc handling bug