fixed a bug at arrays' bounds