Tentative to make getAgent more robust