added systemIsLeaving