fix comparison function