fixed file opening issues