Fixing the cancelProcess function.