fix compatibility for <=3.2 python. fix py2/3 compatibility issue with file size determination.