Fixing some bugs relating to selector production.