Correcting variable declarations for multi threading
Merge origin/master