Changed InstanceGenerator code