Fix some visual-mode related bugs.