Fix bug in setSharedState()