fixed array dereferencing bug