fix #843 Trim deployment at write time