make input key check and exit func