Fix for loop issues

I was not reload the rhs expression at the beginning of every loop.
A few other bugs along the way