Improved handling of malformed replies.
Merge branch 'master' into better-client

Malformed replies handling.