adding n_loss rule, but it is kinda broken...