exit func fix