Fix segmentation fault in setRight()