fix#2 index out of bounds exception