Fix pythonic index conversion