Fixing mouse events related errors