Fixed some Array Out of Bounds bugs