Fix #9244

The proper solution will, I'm sure, at least include proper cleanup, but this hack was sufficient to get my simple use case working for me.