Fix middle mouse bugs