added missing loss function