Fix bug with unique name generation