Fixed a loop that only worked in webkit.