Fixed a potential segmentation fault nightmare.