This should have been part of 4dab108fb5e7e21a547733bb00ddb5d8bffd936d,
but when I was rebasing, these changes got moved to an unrelated commit
that hasn't been pushed yet, and I didn't notice immediately. I will
add som API tests for this in the next few days.