This shouldn't be necessary here either.  All the selected() function is doing here is checking equality, not executing code. If it were necessary, a simple is_numeric() check would suffice.