Added code for support Array.forEach in old browsers.