         PUSH_BEHIND(insert_pos, action_time);
 
     if (!invert)
-        prepare_action(alarm, actionspec, true);
+        prepare_action(alarmno, time, actionspec, true);
 }
 
 static inline void clear_actions(uint8_t alarmno) {

            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;
