Fix issues with ui element states