Restoring some logic that seemed broken but was important with handling of chatrooms (and likely more things). The restored version is somewhat less confusing.