Solution for #1261

- making arrays for global scope
- some optimization for arrays loaded check