fixing scope issue in dynamicselect.js