fixed invalid array reference