The line above this one is

    if (want != acting) {

which is missing the backfill target ( it was previously want.push_back(*i) in calc acting but is now pushed in backfill instead ). That should probably be something like

    if ( want + (backfill.empty() ? backfill[0] : [] ) != acting )