Fixed issue with wrong UI buttons state. Second approach.