fixng exit bugs