Fix forIn rather than each for iterating on object