fixed: resize arrays before insertions

current code tries to insert into empty arrays.