Fix obviously wrong wave equality function (with tests)