Fix create alarm logic. Fix tests.