fix cadet api: handle shutdon correctly