Make mouse support more robust