r741: fixed segfault in rare cases