fix SIGSEGV

Issue #2206