Some debugging on index out of bounds error