bugfixing for couchstore

Change-Id: I4f2bfb4c54b4a14458f7d5b8378b9bd2837e201a
Reviewed-on: http://review.couchbase.org/30681
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>