fix bug where mouse relative position was not update correctly