only registerExitHandler is pin is not null