added file existency check