fix doc indexing and associated test cases