added correct handling of UTF8 files