fixed some array issues, but not fully handled