Fix crash on middle mouse button.