Fix up cancel function