early exit on equality

resolve issue #6