datacenter -> region.
Update changes.
DATACENTER -> REGION.
Fix a bug with data encoding.

encode_data shoud only be called if data is present.