use createEvents and initEvent instead of new MouseEvent
Better error management