Fix COOKIE SHA1 auth
Cleanup marshaling code