Fixed to work with binary files