Finish acceptance tests, fix a bug in count_by_field.