correctly check array