fix bug when name is undefined