need to strip the ends before write