Corrected handling of control C