fixed bugs in adding objects sharing the same name and applying selectors