added check for css to avoid timing problems