MDL-47778 tool_monitor: check courses exist before loop