fixed array out of bounds when creating new items