Collapsing multiple elements when resource == ''

There was an asymmetry between list/expand and related collapse function. Fix that.