fix isValid functions of AgentProgram and UnitTest (+docfix)