Fix a bug in which the newly selected ID is set to a wrong variable in mistake.