gi: fix out of index access