traversal and file opening errors handled