Change file reading to be binary safe and ruby 1.8 compatible