Fix task resolve bug occuring when there are no tasks left in queue