added dir to file opening