Return the right constant from Agent_OnLoad

Related to rhbz#1049011
Add a test for multiple calls of Agent_OnLoad

Related rhbz#1049011