fix file handle