Fix a bug where unsorted reads were accepted, plus a test.

One more step on the way to a fix for issue #20.