Work around SortedSet thread safety bug (fixes #20)