Fixed the swapping of items with variable sizes