[IMP] Implements some checks on vals before cancel, better cancel log management and fixes some Flake8