Correcting a really bad segfault