#1294: fix triggering into duplicate namelists

This fixes #1294.

The bug was due to altering a list while looping over it - not a
good idea... (my fault).

@matthewrmshin, please review.