Fixed out of bounds exception