Fix issue with attributes going out of scope.