Trying to repair segfaults