Potential segfault fix