Since the bug report specifically says "on dead cursor" I feel like one "dead" statement after the foreach() should be here?