Add auto cancel and fix compile