You have of course added code to deal with the restart and then transfer control to your sketch? Haven't you?
Mark