Fix segfaults in ufo handling.