Fix random task retrieval