Fixes to alarm handling