Fix the mouse events when adding a new element