fixed model.each().then chaining