OOIION-1561: Fix to agent control script
Merge pull request #1607 from mmeisinger/fix1561_fix_r2

OOIION-1561: Fix to agent control script