Fix detection of objects in arraylist