fixed array index problem