file: fix write method.