Added null check before creating distributed objects.