refactored code so that instance is only set when the object is configured

following issue #206
refactored code so that instance is only set when the object is configured