Fix get_details to compare against task_name

Current implementation of get_details never compares against task_name and so it just always returns details for the last item in the queue.