Latest commit 9d36d39 Jan 16, 2017 @adamlwgriffiths adamlwgriffiths Fix for #1521
The merge from #1521 fixed the invalid variable error
but it fixed in in a way that introduced another error:
"dictionary changed size during iteration"
This correctly applies the fix.