added support for more than 64 threads