Fixed potential segfault