Check if file exists before using it