Fixed cntrl-c bug