fix file opening