Adding case for nil. Fixed 2 seg faults