added write out for preserving