corrected mistake with array method