fixed a bug

after starting the program,doing nothing and close it,it reported error.fixed by initialize self.num and self.starttime.