fix for callbacks in more complicated situations