added check that file exists