Fixed sorting error.

There's no plain object.forEach().