Merged Hui's changes.
Removed some memory allocation bugs in SetCenterLine() methods.