improvements to $set reference