Small bugfix in poll_agent
Merge pull request #149 from guidow/poll_agent_bugfixes

This is a very small and self-contained fix, so I'm merging it directly.