Added some bug fixings when mousemove handler