fixed some bugs with array sizes