fixed ArrayOutOfBounds errors!

still need to fix NullPointException errors