fix compare bugs