Fixed an out-of-bounds error that we failed to catch before.