creating and terminating of instances functioning correctly