Fixed array access bug