fix use after free bug

argh, not smart. I looked around and didn't see any more like this.