Very minor optimization
Bug fix for threading issue that could create a dangling pointer in certain situations. Fixes issue #14