first fix on array mode, still not finished