fix: should be set null to root segment if pointer of root segment has been deallocated.
change: variable segment to be treated as an option.