bug fix

there was a noticed error when running the program, this was caused by
the program going out of the bound of an array.  this should fix the
problem.