debugging leaf array indexing issue