Corrected some local 'mapindex' variables shadowing the global one

Signed-off-by: Haru <haru@dotalux.com>