fixing ui flickering issue