make encode return a Selector