add cancel prevention mechanism, improve cancellation for key import