Added file verification before saving