wait for array items before trying to print them