fixed arrangeCards comparison function