fix comparison routine