Fixed a bug in fetching tasks