Fix ESC bugs.