Fixes for encoding, bad parameters

Merged up from v1.1-dev