fixed array index problem while loading