Fixed an intermittent segfault
Merge pull request #328 from peastman/master

Fixed an intermittent segfault