Stupid out-of-bounds array bug