try to avoid DOM flicker