It is an existing bug, your fix is just happens to be part of the already-broken loop