Fixed bug in handle_duplicate_objects; the break statement was causing certain cases to not be correctly replaced