Are you sure you are comparing the right thing?
If the new performance is worse (less then) the old one, then you should reset your model.
Currently newPerformance is defines as the loss. Shouldn’t you change the comparison then to newLoss > oldLoss?