fixed encoding bug in long files support

Fixes issue #34