modify the new_by_name function such that it returns all the matching objects if names are duplicated, in list context (return the first element in scalar context)