fix bug in compare