modify createInstance method of InstanceImpl class.