Encoding and syntax fixes