fixed error: dict object has no attribute changed region.endpoint to region[endpoint]