fix duplicate var issue

jshint reports the use of the undeclared var `d`.
I'm not entirely sure that the fix is correct. Apparently, the problem was introduced in d9fd6e16cdb68e605053857673b5f800ef459746 with the intention of fixing another jshint issue. As I understand it, that var `d` in the `for` loop shadows the variable `d` from the `generator` function, so I renamed it.