(turns out that passing NULL to string cmp funcs has "undefined behavior".) Thanks to Grant Paul for this quickfix!