fix compare TypeError