fix criteria iterator

Change-Id: Iae05fb333046e5d98aefca5708062a82ae306345
Reviewed-on: http://review.couchbase.org/37183
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: buildbot <build@couchbase.com>