BUGFIX: Fix segfault on some occasions