changed to average loss