updating losses