fix file reading in python 3