Fix hooking setUserAgent

Refs #825