Issue #139: Fix count and pagination.

@amitaibu I have no problem tracing it down.