code fixed in case of duplicate names