Fixed a segfualt issue