set compare function.