fixed bugs in session send functions

Ignore-this: b881393bafe6e21923f6bcb982f391a3

darcs-hash:20130902033303-c21fe-e1ca5bbea4533e53a0157628e849ee875e54d223