allow trailing 1s in subarray indexing. fixes #3697