Fixed some array problems