Solved index out of exception