Properly handle ghost tasks in getTasks