fix compare method: use legacy logic