Fix not allow to return correct name, instead of always referencing last name in loop