bug fixed clear then exit