Fixing &amp encoding bugs