Fix for segfault