fixes rare NULL pointer bug in realloc().(I hope)