agent: fixing event handler invocation on windows for #37