File write fixed