fix potential segfault