added file_exits checks