Fix the sigsegv at the end