Fixed compiler errors
Merge branch 'ThreadFix' into Threading