fix compare method