Fix "get_nth_item_type" function

Fixed the "get_nth_item_type" function, which was returning heavy item
indices instead of types.