Write file bug fix.
Small fix for data slicing