Fixed the index_length() function
Previously: index_length(4) == 3
Now:        index_length(4) == 2