Fix possible nil termination