fixed compare method.