Mark two variables as volatile

Marking as volatile two variables that are accessed from multiple
threads.
Fix multithreading bug

Revert part of commit 090f557 that caused a multithreading bug.
Merge pull request #49 from mmorearty/threading-fixes

Threading fixes