The if condition is wrong, should be using `iter_opts[lsname]` instead. Fixed that.