added working check if file exists