Fix some mouse bugs that were introduced by the previous commit.