Examples fixes
Thread counting fix
Merge pull request #274 from anton-ryzhov/fixes

Examples and thread counting