thread marshalling improvements for plugin