Add error handling to a thread global
Merge pull request #5 from mgdm/fixGlobals

Add error handling to a thread global