fixed an error in constraint generation for for loops