fix id writing