Fixed some arrays overflows