add code for protected-mode.