fix memory leak in array list