Bugfix for segfault