patches for saveAgent