fix bug when L2 errors are equal