added null checks to FileManager