added checking of file correctness