replace segfault with assert.