Fix item switching bug