Bug with write fixed