fix SIGSEGV on early return case