change the type check of compare.