fixing task timeout issue, and adding cancel method