Fixed SEGFAULT crash