Fixed a potential segfault