added 'index wrap' code to item sharedfunc