Fix indexes in Python again.

The same fix as #309 in another methods: `update_indexes_internal` and `update_indexes`.
Sorry for opening another one issue. I did not notice the error in these functions last time.