updated file opening way