added averageLoss to the examples

In the previous PR I forgot to add the averageLoss information to the examples. I am going also to merge it into the master branch.