Attempts to fix segfaults noted in issue #11

Is this actually required for this PR? There is no condition variable usage below.