fixing bug with event handlers in cpied elemnent