fix bug constructing ArrayLists