Fixed segfault on Ubuntu