fixed creating new class instances at global scope.