fix encoding and more