         NEXT(iterator);
     }
     action_time_t * action_time = MALLOC_TYPE(action_time_t);
-    action_time->alarmno = alarm->alarmno;
+    action_time->alarmno = alarmno;
     action_time->timestamp = action_timestamp;
     action_time->actions = actionspec->actions;
     action_time->actions.flags.inverted = invert;

            if (actionno == GET_MEMBER(action_iterator, action_t, actionno)) {
                linked_list_t * actionspec_iterator = GET_MEMBER(action_iterator, action_t, actionspecs);
                while (actionspec_iterator != NULL) {
                    prepare_action(alarm, GET_ITEM(actionspec_iterator, actionspec_t), false);
                    NEXT(actionspec_iterator);
                }
            }

    return NULL;
}

static inline void prepare_action(uint8_t alarmno, time_t time, actionspec_t * actionspec, bool invert) {
    time_t action_timestamp = time + actionspec->offset;

    if (invert)
        action_timestamp += actionspec->timeout;
