add insert_leave hook and corresponding setting