fix encoding

fix issue #510