added file and OSError management