fix build iterator

Change-Id: Idf1e6cb3694aff2ebdead4ea6097c29ca5ddc5b2
Reviewed-on: http://review.couchbase.org/36997
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Li Yang <lichenyang2@gmail.com>