Fix segfault described in issue 19