Fix the same bug as #309, but in update_indexes_internal and

update_indexes.
Merge pull request #310 from noxiouz/fix_indexes

Fix indexes in Python again.