bugfix each loop