in reply to which loop is better

Please post your code that caused the wrong elements to be taken. I bet there were other differences, apart from 'each'.