added wait for main element to exist