patch segfault