Changestate couchdb connection failure fix

This patch fixes #4833