Fixed segfault error only occuring in linux