add cancel function for Task