Fix problem with newest compiler

The new version of the compiler optimizer would release the object
immediately. This fix goes around this.