Fix page fault on switching terminals