Ensure mouse object is present before using. Fixes #573