Fixed thread statics.
Merge pull request #760 from eightyeight/fix-thread-statics

Fixed thread statics