Fix segfault issue #1