fixed backup issue and added tests

Change-Id: I04ab9d6fceb640dd16f24b4bebb0ceff6346fe75
Reviewed-on: http://review.couchbase.org/41178
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Ashvinder Singh <ashvinder@couchbase.com>