fix encoding + cleanup