Remove a nasty use-after-free bug.

Replace it with an even more nasty const_cast.  Sheesh.  Hopefully, one
day, I'll sort this mess out.