fix stopping from signals
improve cleanup