Fixes for Windows and encoding