fixed cannot read 'name' of undefined