Fix RemoteAgent and ScriptAgent