working on file write issues