it looks like there is an array bounds issue on line 611