fixes #6191 Need auto-update the name field

Fixed the issue and pushed the code for review, please check it.