Fixes to make ResearchAssistant work better when called from Java