improve createObject for abstract classes