fix file fun in py3