Issue #2822916 by kerby70, corbacho, focus13: Set selected variable before rewriting filter option 'Undefined variable: selected'