arrays indices bug fixed