CBD-924:  fix error in next_build calculation

Change-Id: I389364b039cad6e2444684f2ed1b222b7bab0bac