fixed half of the array ref out of bounds problem (printing an error). still have to fix halting on that.