fixed bug in regions initialization

Bug:
- if there were more regions than threads, some regions would not be initialized