fixed position bug

random position could lead to IndexArrayOutOfBoundsException