Fixed alarm setting logic.