solved segfault error