fixes #153: Race condition when callback is invoked from thread pool