Fix forEach() to work with objects and arrays