Avoid Array out of bound execption